﻿using WebApiClientCore;
using WebApiClientCore.Attributes;
using BPM.Web.Shared.Data;
using BPM.Web.Shared.Auth;
namespace BPM.Web.Shared.Service;

[TokenFilter]
public interface IConfigClient : IHttpApi
{
    /// <summary>
    /// 分页获取系统参数配置
    /// </summary>
    /// <param name="body"></param>
    /// <param name="token"></param>
    /// <returns></returns>
    [HttpGet("sysConfig/page")]
    ITask<XnRestfulResult<PageResult<SysConfig>>> PageAsync(ConfigPageInput body, CancellationToken token = default);

    /// <summary>
    /// 获取系统参数配置列表
    /// </summary>
    /// <param name="token"></param>
    /// <returns></returns>
    [HttpGet("sysConfig/list")]
    ITask<XnRestfulResult<List<SysConfig>>> ListAsync(CancellationToken token = default);

    /// <summary>
    /// 增加系统参数配置
    /// </summary>
    /// <param name="body"></param>
    /// <param name="token"></param>
    /// <returns></returns>
    [HttpPost("sysConfig/add")]
    ITask<XnRestfulResult<string>> AddAsync(AddConfigInput body, CancellationToken token = default);

    /// <summary>
    /// 删除系统参数配置
    /// </summary>
    /// <param name="body"></param>
    /// <param name="token"></param>
    /// <returns></returns>
    [HttpPost("sysConfig/delete")]
    ITask<XnRestfulResult<string>> DeleteAsync(DeleteConfigInput body, CancellationToken token = default);

    /// <summary>
    /// 更新系统参数配置
    /// </summary>
    /// <param name="body"></param>
    /// <param name="token"></param>
    /// <returns></returns>
    [HttpPost("sysConfig/edit")]
    ITask<XnRestfulResult<string>> EditAsync(UpdateConfigInput body, CancellationToken token = default);

    /// <summary>
    /// 获取系统参数配置
    /// </summary>
    /// <param name="body"></param>
    /// <param name="token"></param>
    /// <returns></returns>
    [HttpGet("sysConfig/detail")]
    ITask<XnRestfulResult<SysConfig>> DetailAsync(QueryConfigInput body, CancellationToken token = default);

    /// <summary>
    /// 更新配置缓存
    /// </summary>
    /// <param name="code"></param>
    /// <param name="value"></param>
    /// <param name="token"></param>
    /// <returns></returns>
    [HttpPut("api/config/config-cache/{code}/{value}")]
    ITask<XnRestfulResult<string>> ConfigCacheAsync(string code, string value, CancellationToken token = default);
}
